Skip to content

fix(ui): scope model selection to activated provider during onboarding#2691

Open
tusharmath wants to merge 2 commits intomainfrom
feat/scope-model-selection-to-activated-provider
Open

fix(ui): scope model selection to activated provider during onboarding#2691
tusharmath wants to merge 2 commits intomainfrom
feat/scope-model-selection-to-activated-provider

Conversation

@tusharmath
Copy link
Collaborator

Summary

Scope model selection to the activated provider during onboarding, so users can only pick a model belonging to the provider they just enabled.

Context

During onboarding, after a user selects and activates a provider, the subsequent model-selection step previously showed models from all configured providers. This meant a user could accidentally select a model that belongs to a different (possibly unconfigured) provider, leading to confusing failures at runtime. This change tightens the flow so that immediately after a provider is activated the model list is filtered to that provider only.

Additionally, this PR simplifies the fs_patch range-calculation logic by using a detected line-ending style uniformly (removing per-line \r\n detection), removes the now-redundant out-of-bounds range error variant and its guard, and fixes a macOS Nix flake build by referencing individual Apple SDK frameworks instead of the monolithic pkgs.apple-sdk.

Changes

  • Added an optional provider_filter: Option<ProviderId> parameter to select_model and on_model_selection in crates/forge_main/src/ui.rs.
  • During onboarding (on_provider_activated), both the "no model set" and "current model no longer available" paths now call on_model_selection(Some(provider.id.clone())), restricting the list to the newly activated provider.
  • The /model slash-command and the standalone model-selection path continue to call on_model_selection(None), preserving the current behaviour of showing all providers.
  • Simplified byte-range computation in fs_patch.rs: detect line-ending style once (\r\n vs \n) and apply it uniformly, removing the per-segment \r\n detection and the RangeOutOfBounds error variant.
  • Removed redundant out-of-bounds guard and the associated error tests in fs_patch.rs.
  • Replaced pkgs.apple-sdk with explicit AppKit, CoreGraphics, and Foundation framework references in flake.nix.
  • Removed the jobs/** entry from .gitignore.

Key Implementation Details

select_model now accepts Option<ProviderId>. When Some(id) is passed, a retain call filters all_provider_models to entries where pm.provider_id == id before the interactive selection list is built. When None is passed, the list is unchanged — exactly the existing behaviour. The change is additive and backward-compatible; all existing call-sites pass None except the two onboarding paths that now pass the activated provider's id.

Testing

# Verify the codebase compiles cleanly
cargo check

# Run all tests (snapshot tests are accepted automatically)
cargo insta test --accept

To exercise the onboarding flow manually:

  1. Start the CLI with no model configured.
  2. Run /provider and activate a provider (e.g. Anthropic).
  3. Confirm that the subsequent model picker only lists models for Anthropic.
  4. Run /model from the main prompt and confirm all providers are shown as before.

@tusharmath tusharmath changed the title feat(ui): scope model selection to activated provider during onboarding fix(ui): scope model selection to activated provider during onboarding Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant